<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page isELIgnored="false" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<title>客房控制</title>
</head>
<body>
<h1>客房控制</h1>
<%-- 编码：${ openid }<br/>房间号：${ room_id }<br/>手机号：${ phone }<br/>用户名：${ username } --%>
<br/>timestamp:${ timestamp }<br/>renter_id:${ renter_id } <br/>room_id:${ room_id }<br/>sign:${ sign }
<!-- <a href="http://app.gzbaoya.cn">asd</a> -->
<script src="<%=request.getContextPath()%>/jquery/jquery.min.js"></script>
<script type="text/javascript">
	var url=location.href;
	var rs = decodeURI(url).toString()
	var str1 = JSON.stringify(location.href);
	var str2 = str1.split("&")
	var renterId = str2[0].split("\?")[1].split("=")[1]
	var roomId = str2[1].split("=")[1]
	var timestamp = str2[2].split("=")[1]
	var sign = str2[3].split("=")[1].split("\"")[0];
	console.log("rid="+renterId)
	console.log("roomId="+roomId)
	console.log("time="+timestamp)
	
	console.log("sign="+sign)
//	 if(sign == '123456'){
// 		location.href = "/wx/idex.do"
// 	}
	var url ="<%=request.getContextPath()%>/wx/wxroomconl.do"
	
	$(function(){
		$.ajax({//这个是ajax请求
            url:"<%=request.getContextPath()%>/wx/verifyRoomControlPage.do?renterId="+renterId+"&roomId="+roomId+"&timestamp="+timestamp+"&sign="+sign,
             type:"POST",
             success:function(result){
                 console.log(result)
                 if(result.state == 0){
                	 location.href = "<%=request.getContextPath()%>/wx/idex.do"
                 }
                 //else if(result.state == 1){
                //	 location.href = url +"?renter_id="+renterId+"&room_id="+roomId+"&timestamp="+timestamp+"&sign="+sign
                 // }
             }
         });
		
		console.log("kefang_controller")
	})
</script>
</body>
</html>
